#! /bin/bash
#
#   Generate zapi documentation

#   Generate man pages and website manual
cd doc
echo "Building docs..."
make --quiet
rm -f *.xml    #   Makefile does not detect version differences for XML
for FILE in c*.txt; do 
    ./mkman $FILE
    make `basename $FILE .txt`.xml
done

echo "Generating XML pages for manual..."
FILES=
for FILE in curve.txt curve_*.txt; do
    BASE=`basename $FILE .txt`
    make --quiet $BASE.xml;
    FILES="$FILES $BASE"
done
cd ..

#   Generate README.md and upload to git
gitdown README.txt
git add README.* 
git commit -m "Generated documentation"
git push origin master

